// -----------------------------------------------------------------------------
// M A R I T I M E   R E S E A R C H   I N S T I T U T E   N E T H E R L A N D S
// -----------------------------------------------------------------------------
// Copyright (C) December 9, 2009 MARIN - All rights reserved - http://www.marin.nl
// -----------------------------------------------------------------------------
// Program  :
// Module   :
// File     : ShipPulse.h
// -----------------------------------------------------------------------------

#ifndef SHIPPULSE_H
#define	SHIPPULSE_H

#include "defines.h"
#include "Array2D.h"

#include "ShipGeometry.h"
#include "Pulse.h"

// -----------------------------------------------------------------------------
// class ShipPulse
// -----------------------------------------------------------------------------
/// computes pulse based on panels
/** long description */
// -----------------------------------------------------------------------------
class ShipPulse : public Pulse
{

    typedef Pulse super;

public:

    ShipPulse(const ShipGeometry& ship, double dx, double dy);

    virtual ~ShipPulse();

    virtual void compute(int *px, int *py, Array2D<REAL>* pPulse);

private:

    ShipPulse(const ShipPulse& a_other);
    ShipPulse & operator=(const ShipPulse& a_other);

#ifdef UNITTEST
public:
#endif
    bool intersect(const xxship::Panel& a_panel,
                   int a_i,
                   int a_j,
                   xxship::Panel* a_pIntersection);

    void makePlanes(int imin, int jmin, int imax, int jmax);

    const ShipGeometry& m_geometry;     ///< panels and more of ship
    Array2D<mml::Planed> m_nplanes;     ///< potato cutter north pointing planes
    Array2D<mml::Planed> m_eplanes;     ///< potato cutter east pointing planes
    Array2D<mml::Planed> m_splanes;     ///< potato cutter south pointing planes
    Array2D<mml::Planed> m_wplanes;     ///< potato cutter swest pointing planes
    int m_ewOffset;                     ///< potato cutter horizontal offset
    int m_nsOffset;                     ///< potato cutter vertical offset
};

#endif // SHIPPULSE_H

